﻿using Microsoft.Phone.Controls;
using System;
using System.Diagnostics;
using System.Windows.Input;
using System.Windows.Media;

namespace WPNextPhone8.Views
{
    public partial class ManipulationSample : PhoneApplicationPage
    {
        private TranslateTransform dragTranslation;
        public ManipulationSample()
        {
            InitializeComponent();
            // Add handler for the ManipulationDelta event
            TestRect.ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(Drag_ManipulationDelta);
            dragTranslation = new TranslateTransform();
            TestRect.RenderTransform = this.dragTranslation;
        }

        void Drag_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Debug.WriteLine("执行---");
            // Move the rectangle.
            dragTranslation.X += e.DeltaManipulation.Translation.X;
            dragTranslation.Y += e.DeltaManipulation.Translation.Y;
        }
    }
}